package zero.tech.games.gate.controller;

import java.text.ParseException;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import zero.tech.core.data.Resp;
import zero.tech.core.data.SimpleUser;
import zero.tech.games.gate.service.api.IGmService;

@RestController
public class GmController extends BaseController{
	@Autowired
	private IGmService gmService;
	@RequestMapping(value = "/free-room")
	public Resp freeRoom(HttpServletRequest request, @RequestBody Map<String, Object> map) throws ParseException  {
		SimpleUser simpleUser=super.getLoginUser(request);
		String room_id=String.valueOf(map.get("room_id").toString());
		return gmService.freeRoom(simpleUser,room_id);
	}
	
	@RequestMapping(value = "/forbit")
	public Resp forbitSomeone(HttpServletRequest request, @RequestBody Map<String, Object> map) throws ParseException  {
		SimpleUser simpleUser=super.getLoginUser(request);
		int uid=Integer.valueOf(map.get("uid").toString());
		String service_id=map.get("service_id").toString();
		return gmService.forbitSomeone(simpleUser,uid,service_id);
	}
	@RequestMapping(value = "/forbit-cancle")
	public Resp forbitCancle(HttpServletRequest request, @RequestBody Map<String, Object> map) throws ParseException  {
		SimpleUser simpleUser=super.getLoginUser(request);
		int uid=Integer.valueOf(map.get("uid").toString());
		return gmService.forbitCancle(simpleUser,uid);
	}
}
